`summarise()` has grouped output by 'test_description'. You can override using
the `.groups` argument.
test_description
Frequent Tools
n
# 2. Inspect your data (optional, but highly recommended for debugging)# print(str(plot_data))# print(summary(plot_data$size))# print(sum(is.na(plot_data$size)))# print(range(plot_data$size, na.rm = TRUE))# 1. Define your colors in a named vector# You must assign a color to every category, or the others will disappear/turn grey.my_colors <-c("ASRS"="red", # Replace with your preferred color"CAARS"="blue", # Replace with your preferred color"BAARS"="darkgreen", # Replace with your preferred color"WURS"="brown4", # Replace with your preferred color"Other"="black"# The specific requirement)# 2. Plotggplot2::ggplot(data = plot_data, aes(x = sensitivity,y = specificity,shape = Neurotypical_Only,size = size,color =`Frequent Tools` )) +geom_point() +# 3. Add the manual scalescale_color_manual(values = my_colors) +xlab("Sensitivity (%)") +ylab("Specificity (%)") + ggrepel::geom_text_repel(aes(label = test_description), max.overlaps =10, size =3) +labs(shape ="Neurotypical only" ) +scale_size_continuous(name ="Size", # This sets the legend titlebreaks =c(50, 500, 1000), # Original untransformed values for legendlabels =c("50", "500", "1000"), # Corresponding labelsguide ="legend", # Explicitly request a legend# Set limits based on the *transformed* size values from your plot_data# This is crucial for the scale to match your actual plotted points ) +theme(legend.position ="right")
Warning: No shared levels found between `names(values)` of the manual scale and the
data's colour values.
Warning: There was 1 warning in `dplyr::mutate()`.
ℹ In argument: `AUC_neuropsycho_tests = as.numeric(AUC_neuropsycho_tests)`.
Caused by warning:
! NAs introduced by coercion
d_long_both <- dplyr::bind_rows( d_long_accuracy, d_long_AUC) %>% dplyr::filter(!is.na(value))# Make labels nicer.d_long_both <- d_long_both %>% dplyr::mutate(type = dplyr::case_when( type =="biomarker"~"Biomarker", type =="clinician_interview"~"Clinician\nTool", type =="combination"~"Combination", type =="neuroimaging"~"Neuroimaging", type =="observational"~"Observational", type =="neuropsycho_tests"~"Neuro-\npsychological", type =="peer_rating"~"Peer\nRating", type =="self_report"~"Self-Report",.default = type ),measure =ifelse(measure =="accuracy", "Accuracy", measure) )d_long_both %>% dplyr::filter(!is.na(value)) %>% dplyr::rename(Group = group) %>% ggplot2::ggplot(aes(x = Group, y = value) ) +geom_boxplot() +facet_grid(type ~ measure)+theme(axis.text.x =element_text(angle =90, hjust =1))
The following object is masked from 'package:dplyr':
group_rows
# Function to read CSV and select specific columnsread_adhd_data <-function(file_path) {# Read the CSV file data <-read.csv(file_path)# Select only the required columns clean_data <- data %>%select(n_ADHD, sensitivity_self_report, specificity_self_report, size, ID)return(clean_data)}########################### Usage exampleaccuracy <-read_adhd_data(data_location)############################## Check the resulthead(accuracy)
n_ADHD sensitivity_self_report specificity_self_report size
1 518 NA NA 845
2 38 NA NA 69
3 142 92 NA 280
4 1006 NA NA 1135
5 63 89 13 69
6 70 81 71 140
ID
1 Abramson, 2023{#5}
2 Adamou, 2022{#8}
3 Aita, 2018{#16}
4 Amen, 2021{#28}
5 Bakare, 2020{#45}
6 Bastiaens, 2017{#55}
n_ADHD sensitivity_self_report specificity_self_report size
1 518 NA NA 845
2 38 NA NA 69
3 142 92 NA 280
4 1006 NA NA 1135
5 63 89 13 69
6 70 81 71 140
ID Prevalence One_Minus_Prevalence Sensitivity Specificity
1 Abramson, 2023{#5} 0.6130178 0.38698225 NA NA
2 Adamou, 2022{#8} 0.5507246 0.44927536 NA NA
3 Aita, 2018{#16} 0.5071429 0.49285714 92 NA
4 Amen, 2021{#28} 0.8863436 0.11365639 NA NA
5 Bakare, 2020{#45} 0.9130435 0.08695652 89 13
6 Bastiaens, 2017{#55} 0.5000000 0.50000000 81 71
Accuracy
1 NA
2 NA
3 NA
4 NA
5 82.3913
6 76.0000
#install.packages("kableExtra")accuracy <- accuracy %>%select(-Sensitivity, -Specificity)# Create and save in one pipe chainoutput_file <-"accuracy.html"# Create and savekableExtra::kbl(accuracy) %>%kable_styling(bootstrap_options =c("striped", "hover")) %>%save_kable(file = output_file)
Warning: There was 1 warning in `dplyr::mutate()`.
ℹ In argument: `admin_combination = as.numeric(admin_combination)`.
Caused by warning:
! NAs introduced by coercion
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in max(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "kappa_combination"
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "ICC_combination"
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "cost_combination"
Warning: There was 1 warning in `dplyr::mutate()`.
ℹ In argument: `cost_combination = as.numeric(cost_combination)`.
Caused by warning:
! NAs introduced by coercion
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in max(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "concordance_combination"
Warning: There was 1 warning in `dplyr::mutate()`.
ℹ In argument: `concordance_combination = as.numeric(concordance_combination)`.
Caused by warning:
! NAs introduced by coercion
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in max(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "cost_self.report"
Warning: There was 1 warning in `dplyr::mutate()`.
ℹ In argument: `cost_self.report = as.numeric(cost_self.report)`.
Caused by warning:
! NAs introduced by coercion
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in max(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
Warning: There was 1 warning in `dplyr::mutate()`.
ℹ In argument: `admin_peer_rating = as.numeric(admin_peer_rating)`.
Caused by warning:
! NAs introduced by coercion
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in max(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "kappa_peer_rating"
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "ICC_peer_rating"
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "cost_peer_rating"
Warning: There was 1 warning in `dplyr::mutate()`.
ℹ In argument: `cost_peer_rating = as.numeric(cost_peer_rating)`.
Caused by warning:
! NAs introduced by coercion
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in max(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "concordance_peer_rating"
Warning: There was 1 warning in `dplyr::mutate()`.
ℹ In argument: `concordance_peer_rating = as.numeric(concordance_peer_rating)`.
Caused by warning:
! NAs introduced by coercion
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in max(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
Warning: There was 1 warning in `dplyr::mutate()`.
ℹ In argument: `admin_neuroimaging = as.numeric(admin_neuroimaging)`.
Caused by warning:
! NAs introduced by coercion
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in max(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "kappa_neuroimaging"
[1] "ICC_neuroimaging"
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "cost_neuroimaging"
Warning: There was 1 warning in `dplyr::mutate()`.
ℹ In argument: `cost_neuroimaging = as.numeric(cost_neuroimaging)`.
Caused by warning:
! NAs introduced by coercion
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in max(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "concordance_neuroimaging"
Warning: There was 1 warning in `dplyr::mutate()`.
ℹ In argument: `concordance_neuroimaging =
as.numeric(concordance_neuroimaging)`.
Caused by warning:
! NAs introduced by coercion
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in max(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
Warning: There was 1 warning in `dplyr::mutate()`.
ℹ In argument: `admin_EEG = as.numeric(admin_EEG)`.
Caused by warning:
! NAs introduced by coercion
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in max(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "kappa_EEG"
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "ICC_EEG"
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "cost_EEG"
Warning: There was 1 warning in `dplyr::mutate()`.
ℹ In argument: `cost_EEG = as.numeric(cost_EEG)`.
Caused by warning:
! NAs introduced by coercion
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in max(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "concordance_EEG"
Warning: There was 1 warning in `dplyr::mutate()`.
ℹ In argument: `concordance_EEG = as.numeric(concordance_EEG)`.
Caused by warning:
! NAs introduced by coercion
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in max(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
Warning: There was 1 warning in `dplyr::mutate()`.
ℹ In argument: `admin_biomarker = as.numeric(admin_biomarker)`.
Caused by warning:
! NAs introduced by coercion
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in max(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "kappa_biomarker"
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "ICC_biomarker"
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "cost_biomarker"
Warning: There was 1 warning in `dplyr::mutate()`.
ℹ In argument: `cost_biomarker = as.numeric(cost_biomarker)`.
Caused by warning:
! NAs introduced by coercion
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in max(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "concordance_biomarker"
Warning: There was 1 warning in `dplyr::mutate()`.
ℹ In argument: `concordance_biomarker = as.numeric(concordance_biomarker)`.
Caused by warning:
! NAs introduced by coercion
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in max(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "clinical_misdiagnosis_observational"
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "sensitivity_observational"
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "specificity_observational"
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "admin_observational"
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "kappa_observational"
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "ICC_observational"
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "cost_observational"
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "concordance_observational"
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
Warning: There was 1 warning in `dplyr::mutate()`.
ℹ In argument: `admin_clinician_interview =
as.numeric(admin_clinician_interview)`.
Caused by warning:
! NAs introduced by coercion
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in max(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "kappa_clinician_interview"
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "ICC_clinician_interview"
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "cost_clinician_interview"
Warning: There was 1 warning in `dplyr::mutate()`.
ℹ In argument: `cost_clinician_interview =
as.numeric(cost_clinician_interview)`.
Caused by warning:
! NAs introduced by coercion
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in max(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "concordance_clinician_interview"
Warning: There was 1 warning in `dplyr::mutate()`.
ℹ In argument: `concordance_clinician_interview =
as.numeric(concordance_clinician_interview)`.
Caused by warning:
! NAs introduced by coercion
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in max(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "clinical_misdiagnosis_clinician_tool"
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "sensitivity_clinician_tool"
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "specificity_clinician_tool"
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "admin_clinician_tool"
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "kappa_clinician_tool"
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "ICC_clinician_tool"
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "cost_clinician_tool"
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "concordance_clinician_tool"
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
Warning: There was 1 warning in `dplyr::mutate()`.
ℹ In argument: `admin_feigningADHD = as.numeric(admin_feigningADHD)`.
Caused by warning:
! NAs introduced by coercion
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in max(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "kappa_feigningADHD"
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "ICC_feigningADHD"
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "cost_feigningADHD"
Warning: There was 1 warning in `dplyr::mutate()`.
ℹ In argument: `cost_feigningADHD = as.numeric(cost_feigningADHD)`.
Caused by warning:
! NAs introduced by coercion
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in max(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf
[1] "concordance_feigningADHD"
Warning: There was 1 warning in `dplyr::mutate()`.
ℹ In argument: `concordance_feigningADHD =
as.numeric(concordance_feigningADHD)`.
Caused by warning:
! NAs introduced by coercion
Warning in min(d_now[[test_outcome_and_result]]): no non-missing arguments to
min; returning Inf
Warning in max(d_now[[test_outcome_and_result]]): no non-missing arguments to
max; returning -Inf